package business.service.delegate
{
	import com.adobe.cairngorm.business.ServiceLocator;
	
	import mx.rpc.IResponder;
	import mx.rpc.remoting.RemoteObject;
	
	import valueObjects.Category;
	import valueObjects.Product;
	
	public class ProductAMDelegate
	{
		private var responder:IResponder;
		private var remoteObject:RemoteObject;
		public function ProductAMDelegate(responder:IResponder)
		{
			this.responder = responder;
			this.remoteObject = ServiceLocator.getInstance().getRemoteObject("myRemoteBusinessAM");
		}
		public function addCategoryToDatabase(category:Category):void {
			var call:Object = remoteObject.addCategoryToDatabase(category);
			call.addResponder(responder);
		}
		public function addProductToDatabase(product:Product):void {
			var call:Object = remoteObject.addProductToDatabase(product);
			call.addResponder(responder);
		}
		public function getAllCategories():void {
			var call:Object = remoteObject.getAllCategories();
			call.addResponder(responder);
		}
	}
}